﻿@model IEnumerable<FlowerShop.Core.Models.Tshoppingcars>
@{
    ViewBag.Title = "购物车";
}

<h2>购物车</h2>
@if (Model == null || !Model.Any())
{
    <p>购物车为空！</p>
}
else
{
    <table class="table">
        <thead>
            <tr>
                <th>商品名称</th>
                <th>价格</th>
                <th>数量</th>
                <th>小计</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr>
                    <td>@item.G_name</td>
                    <td>@item.jiage</td>
                    <td>@item.kuchun</td>
                    <td>@(item.jiage * item.kuchun)</td>
                    <td>
                        @using (Html.BeginForm("RemoveFromCart", "Cart", FormMethod.Post))
                        {
                            <input type="hidden" name="productId" value="@item.G_id" />
                            <input type="submit" value="删除" class="btn btn-danger" />
                        }
                    </td>
                </tr>
            }
        </tbody>
    </table>

    <div>
        <p>总价: <strong>@ViewBag.TotalPrice</strong></p>
        <a href="@Url.Action("ClearCart", "Cart")" class="btn btn-warning">清空购物车</a>
        <a href="@Url.Action("ConfirmOrder", "Order")" class="btn btn-success">提交订单</a>
    </div>
}
